home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
GETFILEN.C1
< prev
next >
Wrap
Text File
|
1992-05-30
|
2KB
|
81 lines
/********************************/
/* File: GetFileName.c */
/* */
/* Using Standard File Package */
/* query the user for the name */
/* of a file to open, and return*/
/* the name along with the */
/* working directory id of the */
/* file. */
/* */
/* Paramters: */
/* paramCnt = number of types */
/* params[0..3] = the types to */
/* filter for (see Inside Mac. */
/* I-523 for details */
/* ---------------------------- */
/* To Build: */
/* */
/* (1) Create a project using */
/* this file as well as the */
/* XCMD.Glue.c file. (Set */
/* project type to XCMD (or */
/* XFCN) from the Project menu. */
/* */
/* (2) Bring the project up to */
/* date. */
/* */
/* (3) Build Code Resource. */
/* */
/* (4) Use ResEdit to copy the */
/* resource to your stack. */
/********************************/
#include <MacTypes.h>
#include <OSUtil.h>
#include <MemoryMgr.h>
#include <FileMgr.h>
#include <ResourceMgr.h>
#include <pascal.h>
#include <strings.h>
#include "HyperXCmd.h"
#include "HyperUtils.h"
pascal void main( paramPtr )
XCmdBlockPtr paramPtr;
{
short FileWDID;
long temp;
short numTypes;
short i;
SFTypeList typs;
char FileName[256];
char WDIDString[32];
char comma[2];
if( !paramPtr->paramCount )
numTypes = -1; /* select all since no type specified */
else{
numTypes = paramPtr->paramCount;
for( i = 0; i < numTypes; i++ )
BlockMove( *(paramPtr->params[i]), &typs[i], 4L );
}
*FileName = '\0';
if( GetFileNameToOpen( typs, numTypes, FileName, &FileWDID ) ){
temp = (long)FileWDID & 0xFFFF;
NumToStr( paramPtr, temp, &WDIDString );
PtoCstr( WDIDString );
comma[0] = ','; /* for you MPW folk */
comma[1] = '\0';
strcat( FileName, comma );
strcat( FileName, WDIDString );
CtoPstr( FileName );
}
paramPtr->returnValue = PasToZero( paramPtr, FileName );
}